package com.itrus.util;

import java.math.BigInteger;
import java.util.Date;
import org.bouncycastle.asn1.DERTags;

public class DERUtils
  implements DERTags
{
  public static String BigIntegerToHexString(BigInteger paramBigInteger)
  {
    return BytesToHexString(paramBigInteger.toByteArray());
  }

  public static String BytesToHexString(byte[] paramArrayOfByte)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    int i = 0;
    if (i >= paramArrayOfByte.length)
      return localStringBuffer.toString();
    int j = paramArrayOfByte[i];
    int k = (char)(0xF & j >>> 4);
    char c1;
    label52: int m;
    if (k >= 10)
    {
      c1 = (char)(-10 + (k + 97));
      localStringBuffer.append(c1);
      m = (char)(j & 0xF);
      if (m < 10)
        break label108;
    }
    label108: for (char c2 = (char)(-10 + (m + 97)); ; c2 = (char)(m + 48))
    {
      localStringBuffer.append(c2);
      i++;
      break;
      c1 = (char)(k + 48);
      break label52;
    }
  }

  public static BigInteger HexStringToBigInteger(String paramString)
  {
    return new BigInteger(HexStringToBytes(paramString));
  }

  public static byte[] HexStringToBytes(String paramString)
  {
    if (paramString.length() % 2 == 1);
    byte[] arrayOfByte1;
    byte[] arrayOfByte2;
    int j;
    int k;
    for (String str = "0" + paramString.toUpperCase(); ; str = paramString.toUpperCase())
    {
      int i = str.charAt(0);
      if ((i == 56) || (i == 57) || (i == 65) || (i == 66) || (i == 67) || (i == 68) || (i == 69) || (i == 70))
        str = "00" + str;
      arrayOfByte1 = str.getBytes();
      arrayOfByte2 = new byte[arrayOfByte1.length / 2];
      j = 0;
      k = 0;
      if (k < arrayOfByte1.length)
        break;
      return arrayOfByte2;
    }
    int n;
    label165: int i3;
    if ((arrayOfByte1[k] >= 48) && (arrayOfByte1[k] <= 57))
    {
      n = -48 + arrayOfByte1[k];
      if ((arrayOfByte1[(k + 1)] < 48) || (arrayOfByte1[(k + 1)] > 57))
        break label264;
      i3 = -48 + arrayOfByte1[(k + 1)];
    }
    while (true)
    {
      arrayOfByte2[j] = ((byte)(i3 + (n << 4)));
      k += 2;
      j++;
      break;
      int m = arrayOfByte1[k];
      n = 0;
      if (m < 65)
        break label165;
      int i1 = arrayOfByte1[k];
      n = 0;
      if (i1 > 70)
        break label165;
      n = -55 + arrayOfByte1[k];
      break label165;
      label264: int i2 = arrayOfByte1[(k + 1)];
      i3 = 0;
      if (i2 >= 65)
      {
        int i4 = arrayOfByte1[(k + 1)];
        i3 = 0;
        if (i4 <= 70)
          i3 = -55 + arrayOfByte1[(k + 1)];
      }
    }
  }

  public static byte[] HexToBytes(String paramString)
  {
    if (paramString.length() % 2 == 1);
    byte[] arrayOfByte1;
    byte[] arrayOfByte2;
    int i;
    int j;
    for (String str = "0" + paramString.toUpperCase(); ; str = paramString.toUpperCase())
    {
      arrayOfByte1 = str.getBytes();
      arrayOfByte2 = new byte[arrayOfByte1.length / 2];
      i = 0;
      j = 0;
      if (j < arrayOfByte1.length)
        break;
      return arrayOfByte2;
    }
    int m;
    label92: int i2;
    if ((arrayOfByte1[j] >= 48) && (arrayOfByte1[j] <= 57))
    {
      m = -48 + arrayOfByte1[j];
      if ((arrayOfByte1[(j + 1)] < 48) || (arrayOfByte1[(j + 1)] > 57))
        break label190;
      i2 = -48 + arrayOfByte1[(j + 1)];
    }
    while (true)
    {
      arrayOfByte2[i] = ((byte)(i2 + (m << 4)));
      j += 2;
      i++;
      break;
      int k = arrayOfByte1[j];
      m = 0;
      if (k < 65)
        break label92;
      int n = arrayOfByte1[j];
      m = 0;
      if (n > 70)
        break label92;
      m = -55 + arrayOfByte1[j];
      break label92;
      label190: int i1 = arrayOfByte1[(j + 1)];
      i2 = 0;
      if (i1 >= 65)
      {
        int i3 = arrayOfByte1[(j + 1)];
        i2 = 0;
        if (i3 <= 70)
          i2 = -55 + arrayOfByte1[(j + 1)];
      }
    }
  }

  public static Date StringToDate(String paramString, int paramInt)
  {
    Date localDate = new Date();
    if ((paramInt == 24) && (paramString.length() > 13));
    for (int i = 2; ; i = 0)
    {
      int j = Integer.parseInt(paramString.substring(i, i + 2));
      int k = 0;
      if (j < 50)
        k = 100;
      localDate.setYear(j + k);
      localDate.setMonth(-1 + Integer.parseInt(paramString.substring(i + 2, i + 4)));
      localDate.setDate(Integer.parseInt(paramString.substring(i + 4, i + 6)));
      localDate.setHours(Integer.parseInt(paramString.substring(i + 6, i + 8)));
      localDate.setMinutes(Integer.parseInt(paramString.substring(i + 8, i + 10)));
      localDate.setSeconds(Integer.parseInt(paramString.substring(i + 10, i + 12)));
      return new Date(localDate.getTime() - 1000 * (60 * localDate.getTimezoneOffset()));
    }
  }

  public static int lower_bound(int[] paramArrayOfInt, int paramInt)
  {
    int i = paramArrayOfInt.length;
    int j = 0;
    while (true)
    {
      if (i <= 0)
        return paramArrayOfInt[j];
      int k = i >> 1;
      int m = j + k;
      if (paramArrayOfInt[m] < paramInt)
      {
        j = m + 1;
        i = -1 + (i - k);
      }
      else
      {
        i = k;
      }
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.itrus.util.DERUtils
 * JD-Core Version:    0.6.2
 */